<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAdvertisementsTable extends Migration
{

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('advertisements', function (Blueprint $table) {
            $table->increments('id');
            $table->string('title')->index()->comment('标题');
            $table->string('link')->comment('链接');
            $table->string('position')->comment('广告位置');
            $table->integer('sort')->unsigned()->default(0)->index()->comment('排序');
            $table->string('image_url')->comment('图片地址');
            $table->text('description')->nullable()->comment('描述');
            $table->enum('target', ['_blank', '_self'])->default('_blank')->index()->comment('图片打开方式');
            $table->timestamp('start_date')->default('1970-01-02 00:00:00')->index()->comment('开始时间');
            $table->timestamp('end_date')->default('1970-01-02 00:00:00')->index()->comment('结束时间');
            $table->enum('status',['yes','no'])->comment('状态 yes启用 no禁用')->default('yes');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('advertisements');
    }
}
